﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RuTracker.Interface;

namespace RuTrackerLib.Editors.Links.Editors
{
    class SearchLinkEditor : ILinkEditor
    {
        private readonly string _currentDirectory;
        private readonly ISessionStorage _sessionStorage;

        public SearchLinkEditor(ISessionStorage sessionStorage, string currentDirectory)
        {
            if (string.IsNullOrEmpty(currentDirectory))
                throw new ArgumentNullException("currentDirectory");

            _currentDirectory = currentDirectory;
            _sessionStorage = sessionStorage;
        }


        public Link EditLink(Link link)
        {
            GenericLinkEditor editor = new GenericLinkEditor(_currentDirectory);
            Link newLink = editor.EditLink(link);
            //newLink.HRef += string.Format("&{0}={1}", TrackerInfo.SearchQueryName, _sessionStorage.LastSearchQueryString);
            return newLink;
        }
    }
}
